package com.edu.flink.batch;

import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * DateSet输出流
 * </p>
 *
 * @author jpge
 * @since 2024-04-06
 */
public class SinkDemo {

    public static void main(String[] args) throws Exception {
        // 1. 设置环境
        ExecutionEnvironment executionEnvironment = ExecutionEnvironment.getExecutionEnvironment();

        // 2. 设置输入源
        List<String> list = new ArrayList<>();
        list.add("abc");
        list.add("def");
  
        DataSet<String> dateSet = executionEnvironment.fromCollection(list);
        dateSet.writeAsText(System.getProperty("user.dir") + "/flink-demo/target/SinkDemo.txt");

        executionEnvironment.execute();

    }

}
